# coding=utf-8

# import servers



from tests.modules.ucloud.ucloud_db import UcloudApp

servers = [
    '172.16.3.207',
    '172.16.3.172',
    '172.16.2.115',
]


def deal_all_db():
    for ser in servers:
        _ip = ser

        uc = UcloudApp(ip=_ip)

        try:

            _app_name = 'csi'
            _zone = 'uc.gzidc.area'
            _zone_alias = 'gzidc'
            _port = '6390'
            _app_type = 'tomcat'

            uc.do_insert(app_name=_app_name,
                         zone=_zone,
                         zone_alias=_zone_alias,
                         port=_port,
                         app_type=_app_type)

            uc.commit()


        except BaseException, ex:
            print ex.message

        finally:

            uc.close()


deal_all_db()
